Week 2 Practices (0909)
1 Import Data
Import the package
tidyverse, which contains several useful functions for data wrangling and visualization.Create a folder on your computer to store the dataset downloaded from NTU COOL or OpenIntro website.
Set your working directory as that folder and import the datasetscounty.csvandloan50.csv.
2 Scatter Plot
- Use
county.csvto draw the scatter plot ofunemployment_rate(x-axis) andper_capita_income(y-axis).
Tip
Hint: You don’t need to specify any parameter in geom_point().
Draw the same graph again, but this time make the following adjustments:
- adjust the point color to
lightcoral - adjust the point size to
0.5
- adjust the point color to
3 Histogram
Use loan.csv data to draw the histogram of loan_amount (set as x-axis), and adjust the parameter binwidth in geom_histogram() to 5000.